Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Remove lifecycle hooks in learning path related components #9248

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

JohannesWt
Copy link
Contributor

@JohannesWt JohannesWt commented Aug 26, 2024

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding and design guidelines.
  • I documented the TypeScript code using JSDoc style.

Motivation and Context

When using signals, lifecycle hooks are not needed anymore.

Description

This PR removes the remaining lifecycle hooks of the learning path feature using signals and effects.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • at least 2 competencies
  • at least 1 lecture unit and 1 programming exercise connected to a competency
  1. Log in to Artemis
  2. Navigate to Student learning path UI
  3. Navigate between learning objects
  4. navigate between learning objects using the navigation overview
  5. basically check if everything still works as expected

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

unchanged

Scweenshots

unchanged

Summary by CodeRabbit

  • New Features

    • Enhanced loading mechanisms for components, improving state management and responsiveness.
  • Bug Fixes

    • Corrected the loading state checks to streamline user experience during data fetching.
  • Refactor

    • Transitioned from traditional lifecycle hooks to reactive programming paradigms, improving maintainability and readability across components.
  • Tests

    • Updated unit tests to reflect changes in method and property names, ensuring alignment with the refactored component logic.

@JohannesWt JohannesWt self-assigned this Aug 26, 2024
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Aug 26, 2024
@JohannesWt JohannesWt temporarily deployed to artemis-test5.artemis.cit.tum.de August 26, 2024 08:25 — with GitHub Actions Inactive
@JohannesWt JohannesWt marked this pull request as ready for review August 26, 2024 08:29
@JohannesWt JohannesWt requested a review from a team as a code owner August 26, 2024 08:29
Copy link

coderabbitai bot commented Aug 26, 2024

Walkthrough

The changes involve a significant refactoring of several components in the Angular application, transitioning from traditional lifecycle hooks to utilizing the effect function for managing asynchronous operations and state. This includes renaming properties and methods to standardize naming conventions across components, enhancing clarity and maintainability.

Changes

Files Change Summary
src/main/webapp/app/course/learning-paths/components/learning-path-lecture-unit/... Renamed isLectureUnitLoading to isLoading; replaced observable-based lectureUnit$ with a signal; renamed getLectureUnit to loadLectureUnit.
src/main/webapp/app/course/learning-paths/components/learning-path-nav-overview-... Removed OnInit implementation; replaced ngOnInit with effect for data loading; updated selectLearningObject to return Promise<void>.
src/main/webapp/app/course/learning-paths/components/learning-path-nav-overview/... Introduced effect for managing competencies; simplified data flow by using signals directly.
src/main/webapp/app/course/learning-paths/components/learning-path-student-nav/... Removed OnInit; replaced ngOnInit with effect in the constructor; updated selectLearningObject to return Promise<void>.
src/main/webapp/app/course/learning-paths/pages/learning-path-student-page/... Shifted from OnInit to effect for loading learning path ID; enhanced type safety for courseId.
src/test/javascript/spec/component/learning-paths/components/learning-path-lecture-unit... Updated test spies for renamed methods and properties, reflecting internal logic changes.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

@JohannesWt JohannesWt changed the title Learning paths: Remove lifecycle hooks Learning paths: Remove lifecycle hooks Aug 26, 2024
@Jan-Thurner Jan-Thurner temporarily deployed to artemis-test1.artemis.cit.tum.de August 26, 2024 11:07 — with GitHub Actions Inactive
Copy link
Contributor

@Jan-Thurner Jan-Thurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on TS1, still works as expected.

Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code

Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on ts1, did not find issues, navigating from student view worked fine

Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code

@krusche krusche changed the title Learning paths: Remove lifecycle hooks Development: Remove lifecycle hooks Aug 26, 2024
Copy link
Contributor

@sarpsahinalp sarpsahinalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code

@bassner bassner added this to the 7.5.1 milestone Aug 29, 2024
@bassner bassner changed the title Development: Remove lifecycle hooks Development: Remove lifecycle hooks in learning path related components Aug 29, 2024
@bassner bassner merged commit c256301 into develop Aug 29, 2024
63 of 67 checks passed
@bassner bassner deleted the feature/learning-paths/remove-lifecycle-hooks branch August 29, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) ready to merge small tests
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants